﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using JKF.DataModule.IDAL;
using JKF.Substructure;

namespace JKF.DataModule.SqlServerDAL
{
    /// <summary>
    /// 数据访问类dalCUSTOMER_MEMORIALDAY。
    /// </summary>
    public partial class dalCUSTOMER_MEMORIALDAY : IdalCUSTOMER_MEMORIALDAY
    {
        public static void RemoveByCustomer(string customerKey)
        {
            DB.HR.ExecuteNonQuery(CommandType.Text, string.Format("delete from CUSTOMER_MEMORIALDAY where CUSTOMER_KEY='{0}'", customerKey));
        }

        public static List<string> GetMemoryDayNames()
        {
            var data = new List<string>() { "生日" };
            var dt = DB.HR.ExecuteDataSet(CommandType.Text, string.Format("select distinct [name] from dbo.CUSTOMER_MEMORIALDAY")).Tables[0];
            if (dt != null && dt.Rows.Count > 0)
            {
                data.AddRange((from t in dt.AsEnumerable()
                               select t.Field<string>("name")
                             ).ToArray());
            }
            return data;
        }
    }
}
